{% load staticfiles %}
<!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="https://js.braintreegateway.com/v2/braintree.js"></script>
    <script src="{% static 'js/bootstrap.min.js' %}"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{% static 'js/ie10-viewport-bug-workaround.js' %}"></script>
     <script src="{% static 'js/custom.js' %}"></script>



     <script>

     function updateCartItemCount(){
     	var badge = $("#cart-count-badge");

     	$.ajax({
     		type: "GET",
     		url: "{% url 'item_count' %}",
     		success: function(data){
     			badge.text(data.count);
     			console.log(data.count);
     		},
     		error: function(response, error) {
     			console.log(response)
     			console.log(error);
     		}

     	})

     }
     $(document).ready(function(){
     	
     	updateCartItemCount()
     })

     </script>